package com.zt.teacher.controller;

import com.zt.common.pojo.ClassSelection;
import com.zt.common.pojo.common.JsonResult;
import com.zt.common.pojo.netty.Sender;
import com.zt.teacher.dto.StudentInfoDTO;
import com.zt.teacher.service.ClassSelectionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * description:
 * author:zt
 * date:2022-01-30
 */
@RestController
@CrossOrigin
@RequestMapping("classSelection")
@Api("选课模块")
public class ClassSelectionController {

    @Autowired
    private ClassSelectionService classSelectionService;

    @GetMapping("getStuInfo/{classId}")
    @ApiOperation("获取指定班级中所有学生的身份信息")
    public JsonResult<List<StudentInfoDTO>> getStuInfoByClassId(@PathVariable int classId){
        return JsonResult.success(classSelectionService.getStuInfoByClassId(classId));
    }

    @PostMapping("addScore")
    @ApiOperation("给指定学生打分")
    public JsonResult addScore(@RequestBody ClassSelection classSelection){
        classSelectionService.addScore(classSelection);
        return JsonResult.success();
    }
}
